package com.heima.admin.controller.v1;

import com.heima.admin.service.AdUserLoginService;
import com.heima.admin.service.AdUserService;
import com.heima.common.dtos.ResponseResult;
import com.heima.model.admin.dtos.AdUserLoginDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AdminLoginController {

    @Autowired
    private AdUserService adUserService;

    /**
     * POST /login/in
     * 管理员登录
     * @param dto
     * @return
     */
    @PostMapping("/login/in")
    public ResponseResult login(@Validated @RequestBody AdUserLoginDto dto){
        return adUserService.login(dto);
    }
}
